<?php
error_reporting(0);
function odudecardBuildRoute(&$query)
{
       $segments = array();

	  
       if( isset($query['controller']) )
       {
                $segments[] = $query['controller'];
                unset( $query['controller'] );
       };
	   if(isset( $query['cate'] ))
       {
                $segments[] = $query['cate'];
                unset( $query['cate'] );
       };
	     if( isset($query['id']) )
       {
                $segments[] = $query['id'];
                unset( $query['id'] );
       };
	       if( isset($query['notify']) )
       {
                $segments[] = $query['notify'];
                unset( $query['notify'] );
       };
	    if( isset($query['xid']) )
       {
                $segments[] = $query['xid'];
                unset( $query['xid'] );
       };
	  
       unset( $query['view'] );
       return $segments;
}


function odudecardParseRoute($segments)
{
       $vars = array();
	   
       // Count segments
       $count = count( $segments );
	   
if($segments[$count-2]=='odudecardlist')
{
   $cate   = explode( ':', $segments[$count-1] );
   $vars['controller'] = 'odudecardlist';
   $vars['cate']   = (int) $cate[0];
   

}

else if($segments[$count-3]=='odudecardshow')
{
   $cate   = explode( ':', $segments[$count-2] );
   $vars['cate']   = (int) $cate[0];
   $vars['controller'] = 'odudecardshow';
   $id   = explode( ':', $segments[$count-1] );
   $vars['id']   = (int) $id[0];

}

else if($segments[$count-4]=='odudecardpick')
{
   $cate   = explode( ':', $segments[$count-3] );
   $vars['cate']   = (int) $cate[0];
   $vars['controller'] = 'odudecardpick';
   $xid   = explode( ':', $segments[$count-1] );
   $vars['xid']   = (int) $xid[0];
   $notify   = explode( ':', $segments[$count-2] );
   $vars['notify']   = $notify[0];


}
else
{
   $cate   = explode( ':', $segments[$count-1] );
   $vars['cate']   = (int) $cate[0];
	
}


return $vars;
}



?>
